package sample.RTTI;

class Pet{}
class Dog extends Pet{}
class Pug extends Dog{}
class Cat extends Pet{}
class Rodent extends Pet{}
class Gerbil extends Rodent{}
class Hamster extends Rodent{}

class Counter{
	int i;
}
public class PetCount {
	static String[] ty={""};
	public static void main(String[]args){
		Pet pet=new Hamster();
		if(pet instanceof Hamster){
			System.out.println("pet is Hamster");
		}
		if(pet instanceof Pet){
			System.out.println("pet is Pet");
		}
		if(pet instanceof Dog){
			System.out.println("pet is Dog");
		}
	}

}
